Skip to content

Adapt UI to both this repo's gateway and agentgateway/agentgateway - #4

Merged
jakemannix merged 2 commits into
mainfrom
claude/adapt-ui-mcp-gateway-lEFGf
Jan 9, 2026
Merged

Adapt UI to both this repo's gateway and agentgateway/agentgateway#4
jakemannix merged 2 commits into
mainfrom
claude/adapt-ui-mcp-gateway-lEFGf

Conversation

@jakemannix

Copy link
Copy Markdown
Owner

Add multi-gateway backend support to Demo UI

Summary

Introduces a backend adapter pattern that allows the Demo UI to work with multiple MCP gateway implementations:

  • MCP Proxy (Python) - The existing Python-based gateway in this repo
  • Agent Gateway (Rust) - The Rust-based gateway in jakemannix/agentgateway

This enables the same UI to be used for testing and demonstrating either gateway implementation by setting environment variables.

Changes

  • demo/ui/backend.py (new) - Backend adapter module with:

    • GatewayBackend abstract base class defining the interface
    • MCPProxyBackend - Implementation for Python mcp-proxy (/mcp/, /status, /oauth/connect)
    • AgentGatewayBackend - Implementation for Rust agentgateway (/mcp, /config, /registry)
    • get_backend() factory function using GATEWAY_BACKEND env var
    • convert_agentgateway_registry() - Format conversion (snake_case → camelCase)
  • demo/ui/main.py - Refactored to use backend adapter:

    • Health checks, tool calls, and OAuth now route through the adapter
    • Added "From Gateway" registry option for agentgateway (fetches live registry)
    • Status badge shows which backend is connected
  • demo/ui/README.md (new) - Documentation covering:

    • Supported backends and their repositories/branches
    • Configuration via environment variables
    • Step-by-step testing instructions for each backend
    • Feature comparison table

Configuration

# Select backend (default: mcp-proxy)
export GATEWAY_BACKEND=mcp-proxy    # or "agentgateway"

# Override gateway URL (optional)
export GATEWAY_URL=http://localhost:8080

Test plan
Start mcp-proxy gateway, verify UI connects and shows "MCP Proxy (Python) Connected"
Test tool listing and execution with mcp-proxy backend
Set GATEWAY_BACKEND=agentgateway, verify UI shows "Agent Gateway (Rust)" in status
Test "From Gateway" registry loading with agentgateway backend
Verify existing tests still pass (uv run pytest)

claude added 2 commits January 7, 2026 19:51
Introduces a backend adapter layer that allows the demo UI to work with
multiple gateway implementations:
- mcp-proxy (Python gateway, default)
- agentgateway (Rust gateway)

New file: demo/ui/backend.py
- GatewayBackend abstract base class defining the interface
- MCPProxyBackend: adapter for current Python mcp-proxy gateway
  - Uses JSON-RPC over /mcp/ with session management
  - Health check via /status
  - OAuth via /oauth/connect
- AgentGatewayBackend: adapter for Rust agentgateway
  - Uses /config for health, /registry for tool definitions
  - Supports loading registry from gateway backend
- Helper functions for registry format conversion between backends
- load_registry_from_file() extracted from main.py

Updated: demo/ui/main.py
- Import and initialize backend based on GATEWAY_BACKEND env var
- Replace direct gateway calls with backend adapter methods:
  - check_gateway_health() -> gateway_backend.check_health()
  - call_tool() -> gateway_backend.call_tool()
  - OAuth connect -> gateway_backend.connect_oauth()
- Add "From Gateway" option in registry selector for agentgateway
- Auto-load registry from agentgateway backend on startup
- Display backend name in status badge (header)

Configuration:
- GATEWAY_BACKEND: "mcp-proxy" (default) or "agentgateway"
- GATEWAY_URL: Backend URL (defaults vary by backend type)

This enables the same UI codebase to be used with either the Python
mcp-proxy or Rust agentgateway backend implementations.
Documents how to test the UI with both MCP Proxy (Python) and
Agent Gateway (Rust) backends, including:
- Required repositories and branches for each backend
- Environment variable configuration
- Feature differences between backends
- Architecture overview of the backend adapter pattern
@jakemannix
jakemannix merged commit c59bdf7 into main Jan 9, 2026
9 of 12 checks passed
@jakemannix
jakemannix deleted the claude/adapt-ui-mcp-gateway-lEFGf branch January 9, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants